import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LoginComponent } from './pages/login/login.component';
import { AppComponent } from './app.component';
import { AuthGuard } from './core/route/auth-guard';
import { UserManageComponent } from './pages/system-manage/user-manage/user-manage.component';
import { MenuManageComponent } from './pages/system-manage/menu-manage/menu-manage.component';
import { LogInfoComponent } from './pages/system-manage/log-info/log-info.component';
import { RoleManageComponent } from './pages/system-manage/role-manage/role-manage.component';
import { SearchMaintainComponent } from './pages/search-maintain/search-maintain.component';
import { MainChannelDiversionModule } from './pages/main-channel-diversion/main-channel-diversion.module';
import { MainChannelDiversionComponent } from './pages/main-channel-diversion/main-channel-diversion.component';
import { IrrigationComponent } from './pages/irrigation/irrigation.component';
import { WelcomeComponent } from './pages/welcome/welcome.component';
import { SfStandardizedComponent } from './pages/safety-production/sf-standardized/sf-standardized.component';
import { CustomEntryComponent } from './pages/entry/entry.component';

const routes: Routes = [
    // { path: "entry", component: CustomEntryComponent },
    { path: "login", component: LoginComponent },
    {
        path: "",
        component: AppComponent,
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        children: [
            {
                path: "map",
                loadChildren: () =>
                    import("./pages/one-map/one-map.module").then(m => m.OneMapModule)
            },
            {
                path: "diversion",
                component: MainChannelDiversionComponent
            },
            // {
            //     path: "dispatch-material",
            //     loadChildren: () =>
            //         import("./pages/dispatch-material/dispatch-material.module").then(m => m.DispatchMaterialModule)
            // },
            // {
            //     path: "project-files",
            //     loadChildren: () =>
            //         import("./pages/project-files/project-files.module").then(m => m.ProjectFilesModule)
            // },
            // {
            //     path: "irrigation",
            //     component: IrrigationComponent
            // },
            {
                path: "data-report",
                loadChildren: () =>
                    import("./pages/data-report/data-report.module").then(m => m.DataReportModule)
            },
            {
                path: "dispatch-plan",
                loadChildren: () =>
                    import("./pages/dispatch-plan/dispatch-plan.module").then(m => m.DispatchPlanModule)
            },
            {
                path: "gooflow",
                loadChildren: () =>
                    import("./pages/gooflow/gooflow.module").then(m => m.GooflowModule)
            },
            {
                path: "examination",
                loadChildren: () =>
                    import("./pages/examination/examination.module").then(m => m.ExaminationModule)
            },
            {
                path: "statistics",
                loadChildren: () =>
                    import("./pages/statistics/statistics.module").then(m => m.StatisticsModule)
            },
            {
                path: "realtime-control",
                loadChildren: () =>
                    import("./pages/realtime-control/realtime-control.module").then(m => m.RealtimeControlModule)
            },
            {
              path: "water-take-projects",
              loadChildren: () =>
                import("./pages/water-take-projects/water-take-projects.module").then(m => m.WaterTakeProjectsModule)
            },
            {
                path: "msg-center",
                loadChildren: () =>
                    import("./pages/msg-center/msg-center.module").then(m => m.MsgCenterModule)
            },
            {
                path: "fee",
                loadChildren: () =>
                    import("./pages/water-fee/water-fee.module").then(m => m.WaterFeeModule)
            },
            { path: "user-manage", component: UserManageComponent },
            { path: "menu-manage", component: MenuManageComponent },
            { path: "role-manage", component: RoleManageComponent },
            { path: "log-info", component: LogInfoComponent },
            { path: 'standardized', component: SfStandardizedComponent},
            {
                path: "search-maintain", component: SearchMaintainComponent
            },
            {
                path: "gate",
                loadChildren: () =>
                    import("./pages/yjq-gate-control/yjq-gate-control.module").then(m => m.YjqGateControlModule)
            },
            {
                path: "sf",
                loadChildren: () =>
                    import("./pages/safety-production/safety-production.module").then(m => m.SafetyProductionModule)
            },
            {
                path: "pm",
                loadChildren: () =>
                    import("./pages/project-mng/project-mng.module").then(m => m.ProjectMngModule)
            },
        ]
    },
    {
        path: "portal",
        canActivate: [AuthGuard],
        loadChildren: () =>
            import("./pages/portal/portal.module").then(m => m.PortalModule)
    },
    {
        path: "welcome",
        component: WelcomeComponent
    },
    {
        path: "display",
        loadChildren: () =>
            import("./pages/display/display.module").then(m => m.DisplayModule)
    },
    {
        path: '**',
        // redirectTo: 'entry'
        redirectTo: 'login'
    }
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule]
})
export class AppRoutingModule {
}
